﻿package com.sh.game.display
{
    import __AS3__.vec.*;
    import flash.display.*;
    import flash.geom.*;
    import flash.system.*;
    import morn.core.components.*;

    public class BMDMovieClip extends Clip
    {
        private var bmds:Vector.<BitmapData>;
        private var _color:ColorTransform;
        private var _frameXY:Array;
        private var _domain:ApplicationDomain;
        private var mPivotX:Number = 0;
        private var mPivotY:Number = 0;
        private var _bmds:Vector.<BitmapData>;
        private var _framSet:Array;
        private var _xml:XML;
        private var _clsurl:Object;

        public function BMDMovieClip(param1:Vector.<BitmapData>, param2:Array, param3:Boolean = true, param4:ApplicationDomain = null)
        {
            var _loc_5:int = 0;
            this._bmds = param1;
            this._framSet = param2;
            this._frameXY = [];
            if (this._framSet)
            {
                _loc_5 = 0;
                while (_loc_5 < this._framSet.length)
                {
                    
                    this._frameXY[_loc_5] = [this._framSet[_loc_5].x, this._framSet[_loc_5].y];
                    _loc_5++;
                }
            }
            this._domain = param4;
            super(null, 1, 1);
            this._autoPlay = true;
            return;
        }// end function

        override protected function initialize() : void
        {
            super.initialize();
            this.clips = this._bmds;
            return;
        }// end function

        override public function set frame(param1:int) : void
        {
            var _loc_2:Array = null;
            super.frame = param1;
            if (this._frameXY)
            {
                _loc_2 = this._frameXY[frame];
                if (_loc_2)
                {
                    this._bitmap.x = _loc_2[0] - this.mPivotX;
                    this._bitmap.y = _loc_2[1] - this.mPivotY;
                }
            }
            return;
        }// end function

        public function get pivotY() : Number
        {
            return this.mPivotY;
        }// end function

        public function set pivotY(param1:Number) : void
        {
            if (this.mPivotY != param1)
            {
                this.mPivotY = param1;
                if (this._bitmap)
                {
                    this.frame = this.frame;
                }
            }
            return;
        }// end function

        public function get pivotX() : Number
        {
            return this.mPivotX;
        }// end function

        public function set pivotX(param1:Number) : void
        {
            if (this.mPivotX != param1)
            {
                this.mPivotX = param1;
                if (this._bitmap)
                {
                    this.frame = this.frame;
                }
            }
            return;
        }// end function

        override public function dispose(param1:Boolean = false) : void
        {
            var _loc_2:BitmapData = null;
            super.dispose(param1);
            this._xml = null;
            this._url = null;
            if (this.bmds)
            {
                for each (_loc_2 in this.bmds)
                {
                    
                    _loc_2.dispose();
                }
                this.bmds.length = 0;
                this.bmds = null;
            }
            if (this._color)
            {
                this._color = null;
            }
            this._domain = null;
            if (this._frameXY)
            {
                this._frameXY.length = 0;
                this._frameXY = null;
            }
            return;
        }// end function

    }
}
